package com.louis.scheduler.support;

import org.quartz.*;

import javax.mail.MessagingException;
import java.util.Date;


/**
 * @author Lijun jiang
 * @Date: May 10, 2011
 * @Time: 1:02:51 PM
 */


public interface JobDetailAndTrigger extends Job {

    /**
     * Get {@link org.quartz.JobDetail} Object in order to store in database
     *
     * @return jobDetail object
     */
    JobDetail getJobDetail();

    /**
     * Get {@link org.quartz.Trigger} Object in order to store in database;
     *
     * @return Trigger object with same group as JobDetail.
     */
    Trigger getTrigger();

    /**
     * do execute
     *
     * @param jobExecutionContext jobExecutionContext object
     * @throws Exception e
     */
    void doExecute(JobExecutionContext jobExecutionContext) throws Exception;

    /**
     * get execute date
     *
     * @return execute date
     */
    Date getExecuteDate();

    /**
     * retry doExecute
     *
     * @param context jobExecutionContext object
     */
    void retry(JobExecutionContext context) throws SchedulerException, MessagingException;

}